#ifndef QWIDGETROPERTY_H
#define QWIDGETROPERTY_H

#include "QtPropertyExplorerLib.h"

#include "QEmptyProperty.h"

#include <QPointer>

namespace QPE {

// todo: this way, this class doesn't really make sense. What we have to do is pass a widget factory instead of the actual widget!

//! This property holds a QWidget and displays it, if the view supports that. If not, it will behave like an empty property
class QTPROPERTYEXPLORER_DLL_EXPORT QWidgetProperty : public QEmptyProperty
{
public:
	//! Constructor
	QWidgetProperty(const QString &name, QWidget* widget = NULL);

	//! The destructor
	~QWidgetProperty();

	//! Returns the widget held by this property
	QWidget* getWidget() const;

	//! Sets the widget for this property. If there is already an old one, it will be deleted.
	void setWidget(QWidget* widget);

	//! Returns a string containing the type of the property
	virtual QString type() const;

	//! Clones this property
	//! \param include_children Indicates whether to also clone the children
	//! \param container If a property is being passed here, no new QProperty is being created but instead it is tried to fill all the data into container. This can also be used when subclassing this function.
	//! \return Returns the newly created property (or container, if it was not NULL)
	virtual QProperty* clone(bool include_children = true, QProperty* container = NULL) const;
};

}

#endif // QWIDGETROPERTY_H
